/*
               File: ModPrsN
        Description: Modificar Persona Natural
             Author: GeneXus Java Generator version 8_0_9-040
       Generated on: 28 de Setiembre de 2010 17:21:38.61
       Program type: Callable routine
          Main DBMS: sqlserver
*/
import java.sql.*;
import com.genexus.db.*;
import com.genexus.*;
import com.genexus.distributed.*;

public final class pmodprsn extends GXProcedure
{
   public pmodprsn( int remoteHandle )
   {
      super( remoteHandle , new ModelContext( pmodprsn.class ), "" );
   }

   public pmodprsn( int remoteHandle ,
                    ModelContext context )
   {
      super( remoteHandle , context, "" );
   }

   public void execute( short aP0 ,
                        String aP1 ,
                        String aP2 ,
                        String aP3 ,
                        String aP4 ,
                        String aP5 ,
                        java.util.Date aP6 ,
                        String aP7 ,
                        byte aP8 ,
                        byte aP9 ,
                        short aP10 ,
                        byte aP11 ,
                        String aP12 ,
                        String aP13 ,
                        String aP14 ,
                        String aP15 ,
                        String aP16 ,
                        String aP17 ,
                        String aP18 ,
                        String aP19 ,
                        String aP20 ,
                        String aP21 ,
                        String aP22 ,
                        String aP23 ,
                        String aP24 ,
                        String aP25 ,
                        String aP26 ,
                        String aP27 ,
                        String[] aP28 )
   {
      execute_int(aP0, aP1, aP2, aP3, aP4, aP5, aP6, aP7, aP8, aP9, aP10, aP11, aP12, aP13, aP14, aP15, aP16, aP17, aP18, aP19, aP20, aP21, aP22, aP23, aP24, aP25, aP26, aP27, aP28);
   }

   private void execute_int( short aP0 ,
                             String aP1 ,
                             String aP2 ,
                             String aP3 ,
                             String aP4 ,
                             String aP5 ,
                             java.util.Date aP6 ,
                             String aP7 ,
                             byte aP8 ,
                             byte aP9 ,
                             short aP10 ,
                             byte aP11 ,
                             String aP12 ,
                             String aP13 ,
                             String aP14 ,
                             String aP15 ,
                             String aP16 ,
                             String aP17 ,
                             String aP18 ,
                             String aP19 ,
                             String aP20 ,
                             String aP21 ,
                             String aP22 ,
                             String aP23 ,
                             String aP24 ,
                             String aP25 ,
                             String aP26 ,
                             String aP27 ,
                             String[] aP28 )
   {
      pmodprsn.this.AV10Tipdoc = aP0;
      pmodprsn.this.AV11Prsnro = aP1;
      pmodprsn.this.AV12Prspri = aP2;
      pmodprsn.this.AV13Prsseg = aP3;
      pmodprsn.this.AV15Prsape = aP4;
      pmodprsn.this.AV14Prsape = aP5;
      pmodprsn.this.AV16Prsfec = aP6;
      pmodprsn.this.AV17Prssex = aP7;
      pmodprsn.this.AV18Estciv = aP8;
      pmodprsn.this.AV19Prsnro = aP9;
      pmodprsn.this.AV20Eduniv = aP10;
      pmodprsn.this.AV21Sitlab = aP11;
      pmodprsn.this.AV23Prsucr = aP12;
      pmodprsn.this.AV24Prsdir = aP13;
      pmodprsn.this.AV25Prsdir = aP14;
      pmodprsn.this.AV26Prsref = aP15;
      pmodprsn.this.AV27Prsref = aP16;
      pmodprsn.this.AV28Paicod = aP17;
      pmodprsn.this.AV29Paicod = aP18;
      pmodprsn.this.AV30Dptoco = aP19;
      pmodprsn.this.AV31Dptoco = aP20;
      pmodprsn.this.AV32Provco = aP21;
      pmodprsn.this.AV33Provco = aP22;
      pmodprsn.this.AV34Distco = aP23;
      pmodprsn.this.AV35Distco = aP24;
      pmodprsn.this.AV36Prsmai = aP25;
      pmodprsn.this.AV37Prsmai = aP26;
      pmodprsn.this.AV38Prsmai = aP27;
      pmodprsn.this.aP28 = aP28;
      initialize();
      /* GeneXus formulas */
      /* Output device settings */
      /* Using cursor P00072 */
      pr_default.execute(0, new Object[] {AV8Prscod});
      while ( (pr_default.getStatus(0) != 101) )
      {
         A35PrsCod = P00072_A35PrsCod[0] ;
         A53TIPDOCC = P00072_A53TIPDOCC[0] ;
         A55PrsNroD = P00072_A55PrsNroD[0] ;
         A57PrsPriN = P00072_A57PrsPriN[0] ;
         A58PrsSegN = P00072_A58PrsSegN[0] ;
         A59PrsApeP = P00072_A59PrsApeP[0] ;
         A60PrsApeM = P00072_A60PrsApeM[0] ;
         A61PrsFecN = P00072_A61PrsFecN[0] ;
         A63PrsSex = P00072_A63PrsSex[0] ;
         A64EstCivC = P00072_A64EstCivC[0] ;
         A65PrsNroD = P00072_A65PrsNroD[0] ;
         A66EduNivC = P00072_A66EduNivC[0] ;
         A67SitLabC = P00072_A67SitLabC[0] ;
         A83PrsUUM = P00072_A83PrsUUM[0] ;
         A81PrsFUM = P00072_A81PrsFUM[0] ;
         A82PrsHUM = P00072_A82PrsHUM[0] ;
         A238PrsDir = P00072_A238PrsDir[0] ;
         A248PrsDir = P00072_A248PrsDir[0] ;
         A239PrsRef = P00072_A239PrsRef[0] ;
         A249PrsRef = P00072_A249PrsRef[0] ;
         A240PaiCod = P00072_A240PaiCod[0] ;
         A244PAICOD = P00072_A244PAICOD[0] ;
         A241DPTOCO = P00072_A241DPTOCO[0] ;
         A245DPTOCO = P00072_A245DPTOCO[0] ;
         A242PROVCO = P00072_A242PROVCO[0] ;
         A246PROVCO = P00072_A246PROVCO[0] ;
         A243DISTCO = P00072_A243DISTCO[0] ;
         A247DISTCO = P00072_A247DISTCO[0] ;
         A254PrsEma = P00072_A254PrsEma[0] ;
         A255PrsEma = P00072_A255PrsEma[0] ;
         A256PrsEma = P00072_A256PrsEma[0] ;
         A53TIPDOCC = AV10Tipdoc ;
         A55PrsNroD = AV11Prsnro ;
         A57PrsPriN = AV12Prspri ;
         A58PrsSegN = AV13Prsseg ;
         A59PrsApeP = AV15Prsape ;
         A60PrsApeM = AV14Prsape ;
         A61PrsFecN = AV16Prsfec ;
         A63PrsSex = AV17Prssex ;
         A64EstCivC = AV18Estciv ;
         A65PrsNroD = AV19Prsnro ;
         A66EduNivC = AV20Eduniv ;
         A67SitLabC = AV21Sitlab ;
         A83PrsUUM = AV23Prsucr ;
         A81PrsFUM = GXutil.serverDate( context, remoteHandle, "DEFAULT") ;
         A82PrsHUM = GXutil.serverTime( context, remoteHandle, "DEFAULT") ;
         A238PrsDir = AV24Prsdir ;
         A248PrsDir = AV25Prsdir ;
         A239PrsRef = AV26Prsref ;
         A249PrsRef = AV27Prsref ;
         A240PaiCod = AV28Paicod ;
         A244PAICOD = AV29Paicod ;
         A241DPTOCO = AV30Dptoco ;
         A245DPTOCO = AV31Dptoco ;
         A242PROVCO = AV32Provco ;
         A246PROVCO = AV33Provco ;
         A243DISTCO = AV34Distco ;
         A247DISTCO = AV35Distco ;
         A254PrsEma = AV36Prsmai ;
         A255PrsEma = AV37Prsmai ;
         A256PrsEma = AV38Prsmai ;
         /* Using cursor P00073 */
         pr_default.execute(1, new Object[] {new Short(A53TIPDOCC), A55PrsNroD, A57PrsPriN, A58PrsSegN, A59PrsApeP, A60PrsApeM, A61PrsFecN, A63PrsSex, new Byte(A64EstCivC), new Byte(A65PrsNroD), new Short(A66EduNivC), new Byte(A67SitLabC), A83PrsUUM, A81PrsFUM, A82PrsHUM, A238PrsDir, A248PrsDir, A239PrsRef, A249PrsRef, A240PaiCod, A244PAICOD, A241DPTOCO, A245DPTOCO, A242PROVCO, A246PROVCO, A243DISTCO, A247DISTCO, A254PrsEma, A255PrsEma, A256PrsEma, A35PrsCod});
         /* Check if program is canceled. */
         /* Exiting from a For First loop. */
         if (true) break;
      }
      pr_default.close(0);
      cleanup();
   }

   protected void cleanup( )
   {
      this.aP28[0] = pmodprsn.this.AV8Prscod;
      Application.commit(context, remoteHandle, "DEFAULT", "pmodprsn");
      exitApplication();
   }

   /* Aggregate/select formulas */
   public void initialize( )
   {
      AV8Prscod = "" ;
      P00072_A35PrsCod = new String[] {""} ;
      P00072_A53TIPDOCC = new short[1] ;
      P00072_A55PrsNroD = new String[] {""} ;
      P00072_A57PrsPriN = new String[] {""} ;
      P00072_A58PrsSegN = new String[] {""} ;
      P00072_A59PrsApeP = new String[] {""} ;
      P00072_A60PrsApeM = new String[] {""} ;
      P00072_A61PrsFecN = new java.util.Date[] {GXutil.nullDate()} ;
      P00072_A63PrsSex = new String[] {""} ;
      P00072_A64EstCivC = new byte[1] ;
      P00072_A65PrsNroD = new byte[1] ;
      P00072_A66EduNivC = new short[1] ;
      P00072_A67SitLabC = new byte[1] ;
      P00072_A83PrsUUM = new String[] {""} ;
      P00072_A81PrsFUM = new java.util.Date[] {GXutil.nullDate()} ;
      P00072_A82PrsHUM = new String[] {""} ;
      P00072_A238PrsDir = new String[] {""} ;
      P00072_A248PrsDir = new String[] {""} ;
      P00072_A239PrsRef = new String[] {""} ;
      P00072_A249PrsRef = new String[] {""} ;
      P00072_A240PaiCod = new String[] {""} ;
      P00072_A244PAICOD = new String[] {""} ;
      P00072_A241DPTOCO = new String[] {""} ;
      P00072_A245DPTOCO = new String[] {""} ;
      P00072_A242PROVCO = new String[] {""} ;
      P00072_A246PROVCO = new String[] {""} ;
      P00072_A243DISTCO = new String[] {""} ;
      P00072_A247DISTCO = new String[] {""} ;
      P00072_A254PrsEma = new String[] {""} ;
      P00072_A255PrsEma = new String[] {""} ;
      P00072_A256PrsEma = new String[] {""} ;
      A35PrsCod = "" ;
      A53TIPDOCC = 0 ;
      A55PrsNroD = "" ;
      A57PrsPriN = "" ;
      A58PrsSegN = "" ;
      A59PrsApeP = "" ;
      A60PrsApeM = "" ;
      A61PrsFecN = GXutil.nullDate() ;
      A63PrsSex = "" ;
      A64EstCivC = 0 ;
      A65PrsNroD = 0 ;
      A66EduNivC = 0 ;
      A67SitLabC = 0 ;
      A83PrsUUM = "" ;
      A81PrsFUM = GXutil.nullDate() ;
      A82PrsHUM = "" ;
      A238PrsDir = "" ;
      A248PrsDir = "" ;
      A239PrsRef = "" ;
      A249PrsRef = "" ;
      A240PaiCod = "" ;
      A244PAICOD = "" ;
      A241DPTOCO = "" ;
      A245DPTOCO = "" ;
      A242PROVCO = "" ;
      A246PROVCO = "" ;
      A243DISTCO = "" ;
      A247DISTCO = "" ;
      A254PrsEma = "" ;
      A255PrsEma = "" ;
      A256PrsEma = "" ;
      pr_default = new DataStoreProvider(context, remoteHandle, new pmodprsn__default(),
         new Object[] {
             new Object[] {
            P00072_A35PrsCod, P00072_A53TIPDOCC, P00072_A55PrsNroD, P00072_A57PrsPriN, P00072_A58PrsSegN, P00072_A59PrsApeP, P00072_A60PrsApeM, P00072_A61PrsFecN, P00072_A63PrsSex, P00072_A64EstCivC,
            P00072_A65PrsNroD, P00072_A66EduNivC, P00072_A67SitLabC, P00072_A83PrsUUM, P00072_A81PrsFUM, P00072_A82PrsHUM, P00072_A238PrsDir, P00072_A248PrsDir, P00072_A239PrsRef, P00072_A249PrsRef,
            P00072_A240PaiCod, P00072_A244PAICOD, P00072_A241DPTOCO, P00072_A245DPTOCO, P00072_A242PROVCO, P00072_A246PROVCO, P00072_A243DISTCO, P00072_A247DISTCO, P00072_A254PrsEma, P00072_A255PrsEma,
            P00072_A256PrsEma
            }
            , new Object[] {
            }
         }
      );
      /* GeneXus formulas. */
      Gx_err = 0 ;
   }

   private byte AV18Estciv ;
   private byte AV19Prsnro ;
   private byte AV21Sitlab ;
   private byte A64EstCivC ;
   private byte A65PrsNroD ;
   private byte A67SitLabC ;
   private short AV10Tipdoc ;
   private short AV20Eduniv ;
   private short A53TIPDOCC ;
   private short A66EduNivC ;
   private short Gx_err ;
   private String AV11Prsnro ;
   private String AV12Prspri ;
   private String AV13Prsseg ;
   private String AV15Prsape ;
   private String AV14Prsape ;
   private String AV17Prssex ;
   private String AV23Prsucr ;
   private String AV24Prsdir ;
   private String AV25Prsdir ;
   private String AV26Prsref ;
   private String AV27Prsref ;
   private String AV28Paicod ;
   private String AV29Paicod ;
   private String AV30Dptoco ;
   private String AV31Dptoco ;
   private String AV32Provco ;
   private String AV33Provco ;
   private String AV34Distco ;
   private String AV35Distco ;
   private String AV36Prsmai ;
   private String AV37Prsmai ;
   private String AV38Prsmai ;
   private String AV8Prscod ;
   private String A35PrsCod ;
   private String A55PrsNroD ;
   private String A57PrsPriN ;
   private String A58PrsSegN ;
   private String A59PrsApeP ;
   private String A60PrsApeM ;
   private String A63PrsSex ;
   private String A83PrsUUM ;
   private String A82PrsHUM ;
   private String A238PrsDir ;
   private String A248PrsDir ;
   private String A239PrsRef ;
   private String A249PrsRef ;
   private String A240PaiCod ;
   private String A244PAICOD ;
   private String A241DPTOCO ;
   private String A245DPTOCO ;
   private String A242PROVCO ;
   private String A246PROVCO ;
   private String A243DISTCO ;
   private String A247DISTCO ;
   private String A254PrsEma ;
   private String A255PrsEma ;
   private String A256PrsEma ;
   private java.util.Date AV16Prsfec ;
   private java.util.Date A61PrsFecN ;
   private java.util.Date A81PrsFUM ;
   private String[] aP28 ;
   private IDataStoreProvider pr_default ;
   private String[] P00072_A35PrsCod ;
   private short[] P00072_A53TIPDOCC ;
   private String[] P00072_A55PrsNroD ;
   private String[] P00072_A57PrsPriN ;
   private String[] P00072_A58PrsSegN ;
   private String[] P00072_A59PrsApeP ;
   private String[] P00072_A60PrsApeM ;
   private java.util.Date[] P00072_A61PrsFecN ;
   private String[] P00072_A63PrsSex ;
   private byte[] P00072_A64EstCivC ;
   private byte[] P00072_A65PrsNroD ;
   private short[] P00072_A66EduNivC ;
   private byte[] P00072_A67SitLabC ;
   private String[] P00072_A83PrsUUM ;
   private java.util.Date[] P00072_A81PrsFUM ;
   private String[] P00072_A82PrsHUM ;
   private String[] P00072_A238PrsDir ;
   private String[] P00072_A248PrsDir ;
   private String[] P00072_A239PrsRef ;
   private String[] P00072_A249PrsRef ;
   private String[] P00072_A240PaiCod ;
   private String[] P00072_A244PAICOD ;
   private String[] P00072_A241DPTOCO ;
   private String[] P00072_A245DPTOCO ;
   private String[] P00072_A242PROVCO ;
   private String[] P00072_A246PROVCO ;
   private String[] P00072_A243DISTCO ;
   private String[] P00072_A247DISTCO ;
   private String[] P00072_A254PrsEma ;
   private String[] P00072_A255PrsEma ;
   private String[] P00072_A256PrsEma ;
}

final class pmodprsn__default extends DataStoreHelperBase implements ILocalDataStoreHelper
{
   public Cursor[] getCursors( )
   {
      return new Cursor[] {
          new ForEachCursor("P00072", "SELECT [PrsCod], [TIPDOCCOD], [PrsNroDoc], [PrsPriNom], [PrsSegNom], [PrsApePat], [PrsApeMat], [PrsFecNac], [PrsSex], [EstCivCod], [PrsNroDep], [EduNivCod], [SitLabCod], [PrsUUM], [PrsFUM], [PrsHUM], [PrsDir1], [PrsDir2], [PrsRefDir1], [PrsRefDir2], [PaiCod1], [PAICOD2], [DPTOCOD1], [DPTOCOD2], [PROVCOD1], [PROVCOD2], [DISTCOD1], [DISTCOD2], [PrsEmai1], [PrsEmai2], [PrsEmai3] FROM [MMPRS10] WITH (UPDLOCK) WHERE [PrsCod] = ? ",true, GX_NOMASK + GX_MASKLOOPLOCK, false, this,0,true )
         ,new UpdateCursor("P00073", "UPDATE [MMPRS10] SET [TIPDOCCOD]=?, [PrsNroDoc]=?, [PrsPriNom]=?, [PrsSegNom]=?, [PrsApePat]=?, [PrsApeMat]=?, [PrsFecNac]=?, [PrsSex]=?, [EstCivCod]=?, [PrsNroDep]=?, [EduNivCod]=?, [SitLabCod]=?, [PrsUUM]=?, [PrsFUM]=?, [PrsHUM]=?, [PrsDir1]=?, [PrsDir2]=?, [PrsRefDir1]=?, [PrsRefDir2]=?, [PaiCod1]=?, [PAICOD2]=?, [DPTOCOD1]=?, [DPTOCOD2]=?, [PROVCOD1]=?, [PROVCOD2]=?, [DISTCOD1]=?, [DISTCOD2]=?, [PrsEmai1]=?, [PrsEmai2]=?, [PrsEmai3]=?  WHERE [PrsCod] = ?", GX_NOMASK + GX_MASKLOOPLOCK)
      };
   }

   public void getResults( int cursor ,
                           IFieldGetter rslt ,
                           Object[] buf ) throws SQLException
   {
      switch ( cursor )
      {
            case 0 :
               ((String[]) buf[0])[0] = rslt.getString(1, 10) ;
               ((short[]) buf[1])[0] = rslt.getShort(2) ;
               ((String[]) buf[2])[0] = rslt.getString(3, 15) ;
               ((String[]) buf[3])[0] = rslt.getString(4, 15) ;
               ((String[]) buf[4])[0] = rslt.getString(5, 15) ;
               ((String[]) buf[5])[0] = rslt.getString(6, 20) ;
               ((String[]) buf[6])[0] = rslt.getString(7, 20) ;
               ((java.util.Date[]) buf[7])[0] = rslt.getGXDate(8) ;
               ((String[]) buf[8])[0] = rslt.getString(9, 1) ;
               ((byte[]) buf[9])[0] = rslt.getByte(10) ;
               ((byte[]) buf[10])[0] = rslt.getByte(11) ;
               ((short[]) buf[11])[0] = rslt.getShort(12) ;
               ((byte[]) buf[12])[0] = rslt.getByte(13) ;
               ((String[]) buf[13])[0] = rslt.getString(14, 10) ;
               ((java.util.Date[]) buf[14])[0] = rslt.getGXDate(15) ;
               ((String[]) buf[15])[0] = rslt.getString(16, 8) ;
               ((String[]) buf[16])[0] = rslt.getString(17, 200) ;
               ((String[]) buf[17])[0] = rslt.getString(18, 200) ;
               ((String[]) buf[18])[0] = rslt.getString(19, 200) ;
               ((String[]) buf[19])[0] = rslt.getString(20, 200) ;
               ((String[]) buf[20])[0] = rslt.getString(21, 3) ;
               ((String[]) buf[21])[0] = rslt.getString(22, 3) ;
               ((String[]) buf[22])[0] = rslt.getString(23, 3) ;
               ((String[]) buf[23])[0] = rslt.getString(24, 3) ;
               ((String[]) buf[24])[0] = rslt.getString(25, 3) ;
               ((String[]) buf[25])[0] = rslt.getString(26, 3) ;
               ((String[]) buf[26])[0] = rslt.getString(27, 3) ;
               ((String[]) buf[27])[0] = rslt.getString(28, 3) ;
               ((String[]) buf[28])[0] = rslt.getString(29, 100) ;
               ((String[]) buf[29])[0] = rslt.getString(30, 100) ;
               ((String[]) buf[30])[0] = rslt.getString(31, 100) ;
               break;
      }
   }

   public void setParameters( int cursor ,
                              IFieldSetter stmt ,
                              Object[] parms ) throws SQLException
   {
      switch ( cursor )
      {
            case 0 :
               stmt.setString(1, (String)parms[0], 10);
               break;
            case 1 :
               stmt.setShort(1, ((Short) parms[0]).shortValue());
               stmt.setString(2, (String)parms[1], 15);
               stmt.setString(3, (String)parms[2], 15);
               stmt.setString(4, (String)parms[3], 15);
               stmt.setString(5, (String)parms[4], 20);
               stmt.setString(6, (String)parms[5], 20);
               stmt.setDate(7, (java.util.Date)parms[6]);
               stmt.setString(8, (String)parms[7], 1);
               stmt.setByte(9, ((Byte) parms[8]).byteValue());
               stmt.setByte(10, ((Byte) parms[9]).byteValue());
               stmt.setShort(11, ((Short) parms[10]).shortValue());
               stmt.setByte(12, ((Byte) parms[11]).byteValue());
               stmt.setString(13, (String)parms[12], 10);
               stmt.setDate(14, (java.util.Date)parms[13]);
               stmt.setString(15, (String)parms[14], 8);
               stmt.setString(16, (String)parms[15], 200);
               stmt.setString(17, (String)parms[16], 200);
               stmt.setString(18, (String)parms[17], 200);
               stmt.setString(19, (String)parms[18], 200);
               stmt.setString(20, (String)parms[19], 3);
               stmt.setString(21, (String)parms[20], 3);
               stmt.setString(22, (String)parms[21], 3);
               stmt.setString(23, (String)parms[22], 3);
               stmt.setString(24, (String)parms[23], 3);
               stmt.setString(25, (String)parms[24], 3);
               stmt.setString(26, (String)parms[25], 3);
               stmt.setString(27, (String)parms[26], 3);
               stmt.setString(28, (String)parms[27], 100);
               stmt.setString(29, (String)parms[28], 100);
               stmt.setString(30, (String)parms[29], 100);
               stmt.setString(31, (String)parms[30], 10);
               break;
      }
   }

}

